<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8"></meta>
  <meta http-equiv="X-UA-Compatible" content="IE=edge"></meta>
  <title>Admin</title>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"></meta>
  <link rel="stylesheet" th:href="@{/public/css/bootstrap.min.css}"></link>
  <link rel="stylesheet" th:href="@{/public/css/font-awesome.min.css}"></link>
  <link rel="stylesheet" th:href="@{/public/css/AdminLTE.min.css}"></link>
  <link rel="stylesheet" th:href="@{/public/css/all-skins.min.css}"></link>
  <link rel="stylesheet" th:href="@{/public/css/main.css}"></link>
</head>
<body class="hold-transition login-page">
<div class="login-box" id="rrapp">
  <div class="login-logo">
    <b>Admin</b>
  </div>
  <div class="login-box-body">
      <p class="login-box-msg">管理员登录</p>
      <div class="alert alert-danger alert-dismissible">
      </div>
      <div class="form-group has-feedback">
        <input type="text" class="form-control" id="username" placeholder="账号"></input>
        <span class="glyphicon glyphicon-user form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="password" class="form-control" id="password" placeholder="密码"></input>
        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
      </div>
      
      <div class="row">
        <div class="col-xs-8">
          <div class="checkbox icheck">
          </div>
        </div>
        <div class="col-xs-4">
          <button type="button" class="btn btn-primary btn-block btn-flat" id="login" onclick="login()">登录</button>
        </div>
      </div>

  </div>
</div>
<script th:src="@{/public/libs/jquery.min.js}"></script>
<script th:inline="javascript">
/*<![CDATA[*/
function login(){
	var data = "username="+$("#username").val()+"&password="+$("#password").val();
	$.ajax({
		type: "POST",
	    url: "sys/login",
	    data: data,
	    dataType: "json",
	    success: function(result){
			if(result.code == 0){//登录成功
				parent.location.href ='index';
			}else{
			}
		}
	});
}
/*]]>*/
</script>
</body>
</html>
